import time

import requests
import re
from selenium import webdriver

driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
print("浏览器成功打开！")



# 简单版
# url = 'https://api.bilibili.com/x/v1/dm/list.so?oid=1512399639'
# headers = {
#     "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0"
# }
#
# response = requests.get(url, headers=headers)
# response.encoding = 'utf-8'
# html = response.text
# content_list = re.findall('<d p=".*?">(.*?)</d>',html)
# content = '\n'.join(content_list)
# with open('billbill弹幕.txt','w',encoding='utf-8') as f:
#     f.write(content)
#
# print(content)

# 复杂版
# url = 'https://api.bilibili.com/x/v2/dm/wbi/web/seg.so?type=1&oid=30068313800&pid=114543489451440&segment_index=1&pull_mode=1&ps=120000&pe=360000&web_location=1315873&w_rid=eba7fc646f9940c4351a045dfabd4eba&wts=1750408109'
# headers = {
#     "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0",
#     "Cookie":"buvid3=D29F8C30-F6EB-2D93-1A10-9539B3EB2E7275116infoc; b_nut=1750076975; _uuid=1108F7D2F-A10EC-652B-5962-5107104310C9EBA74016infoc; enable_web_push=DISABLE; enable_feed_channel=ENABLE; buvid4=DD5DE06E-1499-D3F9-6A6F-CF5DD043A4F376166-025061620-sCaSliaeE4yaxSPVOQEJ8A%3D%3D; DedeUserID=1171107008; DedeUserID__ckMd5=2ecddf351927d5d7; header_theme_version=CLOSE; fingerprint=372b741b276b9f3cdb665fc64ce4393d; buvid_fp_plain=undefined; bp_t_offset_1171107008=1079062236212756480; buvid_fp=372b741b276b9f3cdb665fc64ce4393d; rpdid=|(J~lu)JRYm)0J'u~l||~)uul; b_lsid=B57DB6CA_1978C63AD9E; bsource=search_baidu; home_feed_column=4; bili_ticket=eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTA2NjYyMzIsImlhdCI6MTc1MDQwNjk3MiwicGx0IjotMX0.OzJ7iICjhFS2VBmNWxn30SP1NBKapooNPaNfS6vVNA8; bili_ticket_expires=1750666172; SESSDATA=436aad51%2C1765959033%2Cd7e11%2A61CjAPaZ8Uo_cgB8WFDJZT-KDNhEjhsyHC2de3I75FJyY0zxLb3F0Qnv6cn32E5NXFU-4SVkZnWF9zZWluSkJMR3M2djRxZ3dYV0JPYmhzVGZQLXpySmIwUWlLR1o2Rnp3aDVmMFhETEt2MkUwVkNZdlpXWEtrOThmbWxVQnFfTmZUQS1ib2N4SGVBIIEC; bili_jct=2fc093a155abd672c4f9d6c868fadd45; sid=6h7e0dfl; browser_resolution=958-900; CURRENT_FNVAL=4048"
# }
# # 发送请求
# response = requests.get(url,headers=headers)
# # 获取数据
# html_data = response.text
# content_list = re.findall(':.(.*?)@',html_data)
# print(content_list)





